// pages/components/mask/mask.js
Component({
    /**
     * 组件的属性列表
     */
    properties: {
      
    },

    /**
     * 组件的初始数据
     */
    data: {
      show: false,
      title: "提示",
      contant: "",
      needcancel: true,
      btnwz01: "取消",
      btnwz02: "确定",
      needDelete:false,//右上角删除按钮，默认不显示
    },
    // 生命周期函数，可以为函数，或一个在methods段中定义的方法名
    /**
     * 组件的方法列表
     */
    methods: {
      initialization: function (info) {
        let that = this;
        if (info.title) {
          that.setData({
            title: info.title
          })
        }
        if (info.needcancel == false) {
          that.setData({
            needcancel: info.needcancel
          })
        }
        if (info.needDelete == true) {
          that.setData({
            needDelete: info.needDelete
          })
        }
        if (info.btnwz01) {
          that.setData({
            btnwz01: info.btnwz01
          })
        }
        if (info.btnwz02) {
          that.setData({
            btnwz02: info.btnwz02
          })
        }
        that.setData({
          show: true,
          contant: info.contant,
        })
        if (info.success) {
          that.success = info.success;
        }
        if (info.cancel) {
          that.cancel = info.cancel;
        }
        if (info.delete) {
          that.delete = info.delete;
        }
      },
      /**
       * 确定
       * */
      successBtn: function () {
        if (this.success) {
          this.success("success");
        }
        this.setData({
          show: false,
          title: "提示",
          contant: "",
          needcancel: true,
          needDelete:false,
          btnwz01: "取消",
          btnwz02: "确定",
        })
        // return "success";
      },
      /**
       * 取消
       * */
      cancelBtn: function () {
        if (this.cancel) {
          this.cancel("cancel")
        }
        this.setData({
          show: false,
          title: "提示",
          contant: "",
          needcancel: true,
          needDelete:false,
          btnwz01: "取消",
          btnwz02: "确定",
        })
        // return "cancel";
      },
      /**
       * 右上角删除
       * */
      deleteBtn:function(){
        if (this.delete) {
          this.delete("delete");
        }
        this.setData({
          show: false,
          title: "提示",
          contant: "",
          needcancel: true,
          needDelete:false,
          btnwz01: "取消",
          btnwz02: "确定",
        })
      }
    }
})